﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LogisticDatabase.Models
{
    public class Order
    {

      public int Id { get; set; }
      public String CustomerName { get; set; }
      public Product Product {get; set;}
      public DateTime Date {get; set;}
      public int  Quanity {get; set;}
      public OrderState State {get; set;}
      public String StateText { get; set; }


      public static String OrderStateToString(OrderState orderState)
      {
          if (orderState == OrderState.ACCEPTED)
          {
              return "ACCEPTED";
          }
         /* if (orderState == OrderState.DISMISS)
          {
              return "DISMISS";
          }
          if (orderState == OrderState.STARTED_FACTORY)
          {
              return "STARTED_FACTORY";
          }*/
          if (orderState == OrderState.FACTORY)
          {
              return "FACTORY";
          }
          if (orderState == OrderState.ARRIVIED)
          {
              return "ARRIVIED";
          }
          else
          {
              return "TRANSPORT";
          }
      }

      public static OrderState StringToOrderState(String orderState)
      {
          //ACCEPTED, DISMISS, STARTED_FACTORY, END_FACTORY, TRANSPORT, ARRIVIED
          if(orderState=="ACCEPTED")
          {
              return OrderState.ACCEPTED;
          }
          /*if (orderState == "DISMISS")
          {
              return OrderState.DISMISS;
          }
          if (orderState == "STARTED_FACTORY")
          {
              return OrderState.STARTED_FACTORY;
          }*/
          if (orderState == "FACTORY")
          {
              return OrderState.FACTORY;
          }
          if (orderState == "TRANSPORT")
          {
              return OrderState.TRANSPORT;
          }
          else
          {
              return OrderState.ARRIVIED;
          }
      }
    }
}
